#!/usr/bin/env python
# -*- coding:utf-8 -*-
from django.db import models


# 时间参数：auto_now = True ：则每次更新都会更新这个时间
# auto_now_add 则只是第一次创建添加，之后的更新不再改变。
# user表
class User(models.Model):
	id = models.CharField(max_length=100, primary_key=True)
	name = models.CharField(max_length=20)
	password = models.CharField(max_length=50)
	last_login_time = models.DateTimeField(null=True)
	status = models.CharField(max_length=2)
	phone = models.CharField(max_length=11)


# article表
class Article(models.Model):
	id = models.CharField(max_length=100, primary_key=True)
	title = models.CharField(max_length=150)
	content = models.TextField()
	create_time = models.DateTimeField(auto_now_add=True)
	author = models.CharField(max_length=10)
	status = models.CharField(max_length=2)
	classify_id = models.CharField(max_length=100)


# 博客（文章）类别表
class Classify(models.Model):
	id = models.CharField(max_length=100, primary_key=True)
	name = models.CharField(max_length=50)
	create_time = models.DateTimeField(auto_now_add=True)
	status = models.CharField(max_length=2)


# 博客（文章）评论表
class BlogComment(models.Model):
	id = models.CharField(max_length=100, primary_key=True)
	article_id = models.CharField(max_length=100)
	comment = models.TextField()


# 博客（文章）浏览量表
class BlogPv(models.Model):
	id = models.CharField(max_length=100, primary_key=True)
	pv_num = models.IntegerField(max_length=11)
	article_id = models.CharField(max_length=100)
